<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Welcome Page</title>
<link rel="icon" href="static/images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon" />
<link rel="bookmark" href="static/images/favicon.ico" type="image/x-icon" />
<script src="static/js/jquery-3.3.1.js" type="text/javascript"></script>
</head>
<body onload="GetQueryString(name)">
	<h1 id = "welcome">Welcome! </h1>
	<form>
		<input type="button" id="loginOut" value="注销">
	</form>
	<br /><br/>
	<a href="/jsp/login.jsp">login.jsp</a>
	<br /><br/>
	<a href="/TestSession.html">测试浏览器关闭！</a>


	<script type="text/javascript">
	/* js获得url里参数值 */
		function GetQueryString(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
			var r = window.location.search.substr(1).match(reg);
			if (r != null)
				return unescape(r[2]);
			return null;
		}
	/* js追加字符串 */
		var originalStr=document.getElementById("welcome").innerHTML;
		var node = document.getElementById("welcome");
		var originalStr=node.innerHTML;
		node.innerHTML=originalStr + GetQueryString("name");
	</script>



	<script>
		$("#loginOut").click(function() {
			$.ajax({
				url : "/logout",
				type : "post",
				// 					beforeSend:function(XMLHttpRequest){  
				// 			            //开始请求之前
				// 			            alert("正在获取数据...");   
				// 			        }, 
				success : function(data, textStatus, jqXHR) {
					window.location.href = "/index.html";
				}
			});
		});
	</script>
</body>
</html>